<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 
        需求：我想直到我们按的是哪一个按键？
     -->
    <script>
        document.addEventListener("keydown", function (e) {
            console.log(e.key);
            if (e.key === 'Enter') {
                console.log("回车按键");
            }
        })
    </script>
</body>

</html>